package com.bd;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;

public class MySQLiteHelper extends SQLiteOpenHelper {
   
    public final static String DATABASE_NAME = "dbPetCare_v1";
    private static final int DATABASE_VERSION = 11;
   
    public MySQLiteHelper(Context context) {
        super(context, MySQLiteHelper.DATABASE_NAME, null, MySQLiteHelper.DATABASE_VERSION);
       
    }
   
    @Override
    public void onCreate(SQLiteDatabase database) {
       
        database.execSQL(PetsModule.createTableString());
        database.execSQL(AlarmsModule.createTableString());
        database.execSQL(VetsModule.createTableString());
        
        //new PetsModule("Leopoldo", 1, "", "1", "1", "1", "1", "1", "1").insertPet(database);
        //new PetsModule("Ziva", 1, "").insertPet(database);
        //new PetsModule("Zaraki", 2, "").insertPet(database);
     
    }
   
    @Override
    public void onUpgrade(SQLiteDatabase database, int oldVersion, int newVersion) {
       
        Log.w(MySQLiteHelper.class.getName(),
                "Upgrading database from version " + oldVersion + " to "
                        + newVersion + ", which will destroy all old data");
        database.execSQL("DROP TABLE IF EXISTS " + PetsModule.TABLE_NAME);
       
        onCreate(database);
       
    }

}
